<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>角色列表</title>
<%@ include file="/common/jsp/taglibs.jsp" %>
<%@ include file="/common/jsp/headerScriptCss.jsp" %>
<script type="text/javascript">
     function toSubmit(){
         $("#userRole").ajaxSubmit({
             url:'${ctx }/userRole/add',
             type:"POST",
             dataType:'json',
             success:function(data){
                 if(data.status=='success'){
                     setTimeout(function(){
                         $.dialog.close();
                     },600);
                     showSuccess($("#main",window.parent.document));
                 }else{
                     setTimeout(function(){
                         $.dialog.close();
                     },600);
                     showError($("#main",window.parent.document));
                 }
                 
             }           
         }); 
     }
     </script>
</head>
<body class="dialogBody">
     <form id="userRole">
       <input type="hidden" value="${userId }" name="userId"/>
        <div class="inpcol">
        <c:forEach items="${userRoleList }" var="userRole"  end="${fn:length(userRoleList)/2}">
          <p>
           <input type="radio" name="roleId" value="${userRole.roleId }" 
           <c:if test="${userRole.userId!=null&&userRole.userId==userId }">checked="checked"</c:if> 
            />
          ${userRole.name }
          <p>
       </c:forEach>
        </div>
        
        <div class="inpcol">
        <c:forEach items="${userRoleList }" var="userRole"  begin="${fn:length(userRoleList)/2+1}">
          <p>
           <input type="radio" name="roleId" value="${userRole.roleId }" 
           <c:if test="${userRole.userId!=null&&userRole.userId==userId }">checked="checked"</c:if> 
            />
          ${userRole.name }
          <p>
       </c:forEach>
        </div>
        
        <p style="text-align:center;">
          <input type="button"  class="button"  value="保存" onclick="toSubmit();">
        </p>
     </form>   
</body>
</html>